<?php
// $Id: html.php 207 2012-03-14 09:52:26Z tomqin@gmail.com $

class Html_Controller extends FrontController{

	function init(){}

	function _onDefault(){

		$pages = array(
			'aboutus' => '关于我们',
			'privacy' => '用户协议',
			'contact' => '联络我们',
		);

		if(isset($pages[$this->action])){

			$this->seoTitle($pages[$this->action]);
			$this->setVar('pages', $pages);
			$this->setVar('action', $this->action);

			$this->render('html-default');
		}else{
			header("HTTP/1.1 404 Not Found");
		}
	}


	function onApply(){
		if(array_get($_POST, 'isajax') && array_get($_POST, 'dosubmit')){
			file_put_contents(DATA_PATH.'apply.data', "\n".date('Y-m-d H:i:s')."\n".serialize($_POST), FILE_APPEND);
			echo json_encode(array('error'=>0, 'message'=>'OK'));
		}else{
			$this->setVar('title', '店铺加盟');
			$this->render('html-apply');
		}
	}

}
?>